import { IsNotEmpty, IsString, MaxLength, IsOptional } from 'class-validator';
import { ApiProperty } from '@nestjs/swagger';

/**
 * 创建广告的DTO
 */
export class CreateAdvDto {
  @ApiProperty({
    description: '广告标题',
    example: '新品上市',
    minLength: 1,
    maxLength: 255,
  })
  @IsNotEmpty({ message: '标题不能为空' })
  @IsString({ message: '标题必须是字符串' })
  @MaxLength(255, { message: '标题长度不能超过255个字符' })
  title: string;

  @ApiProperty({
    description: '广告链接',
    example: 'https://example.com/promotion',
    minLength: 1,
    maxLength: 500,
  })
  @IsNotEmpty({ message: '链接不能为空' })
  @IsString({ message: '链接必须是字符串' })
  @MaxLength(500, { message: '链接长度不能超过500个字符' })
  url: string;
}